package org.feiye.studyday14;

import java.util.Scanner;

public class TestCompany {
	public static void main(String[] args) {
		Company com = new Company("飞人网络科技有限公司", "上海浦东区巨人路1号", "8888888", "网络游戏");
		Scanner in = new Scanner(System.in);
		int ch = 0;
		while (true) {
			System.out.println("1:查看公司情况\n2:雇佣新人\n3:开除员工\n4:查找工资最高的员工\n5:涨薪\n9:退出");
			ch = in.nextInt();
			if (ch == 1) {
				com.showinfo();
			} else if (ch == 2) {
				Staff staff = new Staff();
				System.out.println("输入员工基本信息：");
				System.out.println("姓名：");
				staff.name = in.next();
				System.out.println("工号：");
				staff.cNumber = in.next();
				System.out.println("薪水：");
				staff.salary = in.nextDouble();
				System.out.println("性别：");
				staff.gender = in.next();
				boolean f = com.hire(staff);
				System.out.println(f ? "成功" : "失败");
			} else if (ch == 3) {
				System.out.println("输入被辞退员工的工号：");
				String cNum = in.next();
				com.fire(cNum);
			} else if (ch == 4) {
				Staff top = com.findTopSalary();
				System.out.println("薪水最高的人信息如下：");
				if (top == null) {
					System.out.println("目前没人");
				} else {
					top.showinfo();
					System.out.println();
				}
			} else if (ch == 5) {
				System.out.println("输入涨薪幅度：");
				double percent = in.nextDouble();
				com.incrSal(percent);
			} else if (ch == 9) {
				System.out.println("退出程序！");
				break;
			}
		}
	}
}